package com.congee02.springframework.bean;

import com.congee02.springframework.beans.ApplicationContextAware;
import com.congee02.springframework.beans.DisposableBean;
import com.congee02.springframework.beans.factory.*;
import com.congee02.springframework.context.ApplicationContext;
import lombok.ToString;

@ToString
public class UserService implements BeanNameAware, BeanClassLoaderAware, ApplicationContextAware, BeanFactoryAware, InitializingBean, DisposableBean {

    // inject
    private String name;
    private UserDao userDao;

    // processor
    private String company;
    private String location;

    // aware
    private String beanName;
    private ClassLoader beanClassLoader;
    private ApplicationContext applicationContext;
    private BeanFactory beanFactory;


    public void setLocation(String location) {
        this.location = location;
    }

    @Override
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    @Override
    public void setBeanClassLoader(ClassLoader beanClassLoader) {
        this.beanClassLoader = beanClassLoader;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) {
        this.beanFactory = beanFactory;
    }


    @Override
    public void afterPropertiesSet() throws Exception {

    }

    @Override
    public void destroy() throws Exception {

    }
}
